cmake_minimum_required(VERSION 2.8.3)
project(xrobot)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

set(OpenCV_DIR $ENV{OpenCV_DIR})
# set(OpenCV_DIR /home/ghowoght/Software/opencv4/opencv-4.5.1/build)


find_package( PkgConfig )
pkg_check_modules( EIGEN3 REQUIRED eigen3 )

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  message_generation
  roscpp
  rospy
  serial
  std_msgs
  tf
  cv_bridge
  sensor_msgs
  image_transport
  dynamic_reconfigure
  globalplanner
)

#find_package(Eigen3 REQUIRED)

find_package(OpenCV)
message(STATUS "OpenCV status:")
message(STATUS "    Opencv version: ${OpenCV_VERSION}")   
message(STATUS "    Opencv include: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})

# add_message_files(
#   FILES
# )
# generate_messages(
#   DEPENDENCIES
# )

catkin_package(
 CATKIN_DEPENDS
 message_runtime
 INCLUDE_DIRS
)

# 头文件路径
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

# 生成可执行文件
add_executable( robot_node src/robot_node.cpp )
#该项让编译器知道要注意编译顺序
add_dependencies(robot_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 

# 链接库
target_link_libraries(robot_node ${catkin_LIBRARIES})

# 生成可执行文件
add_executable( laser_node src/laser_node.cpp )
#该项让编译器知道要注意编译顺序
add_dependencies(laser_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 

# 链接库
target_link_libraries(laser_node 
                      ${catkin_LIBRARIES}
                      )

# # 生成可执行文件
# add_executable( auto_driving_scheduler src/auto_driving_scheduler.cpp )
# #该项让编译器知道要注意编译顺序
# add_dependencies(auto_driving_scheduler ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 

# # 链接库
# target_link_libraries(auto_driving_scheduler 
#                       ${catkin_LIBRARIES}
#                       )

# 生成可执行文件
add_executable( gps_node src/gps_node.cpp )
#该项让编译器知道要注意编译顺序
add_dependencies(gps_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 

# 链接库
target_link_libraries(gps_node 
                      ${catkin_LIBRARIES}
                      )

# 生成可执行文件
add_executable( tank_node src/tank_node.cpp )
#该项让编译器知道要注意编译顺序
add_dependencies(tank_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 

# 链接库
target_link_libraries(tank_node 
                      ${catkin_LIBRARIES}
                      )